<template>
  <div class="user-profile">
    <CateHea class="user-hea">
      <template #left><i class="iconfont icon-zuojiantou" @click="$router.go(-1)"></i></template>
      <template #center><span>账号管理</span></template>
      <template #right><i class="iconfont icon-shixincaidan"></i></template>
    </CateHea>
    <div class="page">
      <div class="pro-item info">
        <UserInfo v-if="userInfo">
          <template #username>昵称：{{ userInfo.username }}</template>
          <template #account>账号：{{ userInfo.email }}</template>
        </UserInfo>
      </div>
      <div class="pro-item">
        <router-link to="/proFile">修改登录密码</router-link>
        <i class="iconfont icon-jinrujiantou"></i>
      </div>
      <div class="pro-item">
        <router-link to="/proFile">修改个人信息</router-link>
        <i class="iconfont icon-jinrujiantou"></i>
      </div>
      <div class="pro-item">
        <router-link to="/proFile">收货地址管理</router-link>
        <i class="iconfont icon-jinrujiantou"></i>
      </div>
    </div>
    <div class="pro-footer">
      <div class="con">
        <div><i class="iconfont icon-yijianfankui"></i>意见反馈</div>
        <div><span>ZXG</span>客户端</div>
        <div @click="personLogOut()"><i class="iconfont icon-wode-wode"></i>退出登录</div>
      </div>
      <p class="zxg">知心购</p>
    </div>
  </div>
</template>

<script>
import CateHea from '@/components/common/CateHea'
import UserInfo from '@/components/content/user/UserInfo'
import { mapState } from 'vuex'
import { logOut } from '@/http/index.js'
export default {
  components: {
    CateHea,
    UserInfo,
  },
  created() {
    this.$store.dispatch('getInfo')
  },
  computed: {
    ...mapState(['userInfo']),
  },
  methods: {
    personLogOut() {
      // sessionStorage.removeItem('zxgToken')
      // sessionStorage.removeItem('isLogin')
      sessionStorage.clear()
      logOut()
      location.href = '/'
    },
  },
}
</script>

<style lang="scss" scoped>
.page {
  margin-top: 100px;
  padding: 0;
  .pro-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 20px;
    width: 100%;
    font-size: 30px;
    color: #999;
    border-bottom: 1px solid #f7f7f7;
    box-sizing: border-box;
    a {
      color: #999;
    }
  }
  .info {
    justify-content: start;
  }
}
.pro-footer {
  margin-top: 200px;
  .con {
    display: flex;
    > div {
      flex: 1;
      text-align: center;
      font-size: 30px;
    }
  }
  .zxg {
    margin-top: 100px;
    text-align: center;
    font-size: 50px;
    color: #c81623;
  }
}
</style>
